home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / POVSRC / SOURCE / POVMalloc.h < prev    next >
Text File  |  1994-02-04  |  4KB  |  94 lines

  1. /*==============================================================================
  2. Project:    POV-Ray
  3.  
  4. Version:    2.2
  5.  
  6. File:        POVMalloc.h
  7.  
  8. Description:
  9. Library routines and definitions to re-route the Std C library
  10. calls to malloc/free, track them, and handle garbage-collection.
  11.  
  12. ------------------------------------------------------------------------------
  13. Author:
  14.     Eduard [esp] Schwan
  15. ------------------------------------------------------------------------------
  16.     from Persistence of Vision Raytracer
  17.     Copyright 1993 Persistence of Vision Team
  18. ------------------------------------------------------------------------------
  19.     NOTICE: This source code file is provided so that users may experiment
  20.     with enhancements to POV-Ray and to port the software to platforms other 
  21.     than those supported by the POV-Ray Team.  There are strict rules under
  22.     which you are permitted to use this file.  The rules are in the file
  23.     named POVLEGAL.DOC which should be distributed with this file. If 
  24.     POVLEGAL.DOC is not available or for more info please contact the POV-Ray
  25.     Team Coordinator by leaving a message in CompuServe's Graphics Developer's
  26.     Forum.  The latest version of POV-Ray may be found there as well.
  27.  
  28.     This program is based on the popular DKB raytracer version 2.12.
  29.     DKBTrace was originally written by David K. Buck.
  30.     DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
  31. ------------------------------------------------------------------------------
  32. More Info:
  33.     This Macintosh version of POV-Ray was created and compiled by Jim Nitchals
  34.     (Think 5.0) and Eduard Schwan (MPW 3.2), based (loosely) on the original
  35.     port by Thomas Okken and David Lichtman, with some help from Glenn Sugden.
  36.  
  37.     For bug reports regarding the Macintosh version, you should contact:
  38.     Eduard [esp] Schwan
  39.         CompuServe: 71513,2161
  40.         Internet: jl.tech@applelink.apple.com
  41.         AppleLink: jl.tech
  42.     Jim Nitchals
  43.         Compuserve: 73117,3020
  44.         America Online: JIMN8
  45.         Internet: jimn8@aol.com -or- jimn8@applelink.apple.com
  46.         AppleLink: JIMN8
  47. ------------------------------------------------------------------------------
  48. Change History:
  49.     921023    [esp]    Created.
  50.     921202    [esp]    Added POV_need_to_reclaim() routine
  51.     931001    [esp]    version 2.0 finished (Released on 10/4/93)
  52.     931020    [esp]    Added realloc function
  53.     931020    [esp]    Added debug file/line info to malloc/calloc (MALLOC_TRACE)
  54. ==============================================================================*/
  55.  
  56. #if !defined(POVMALLOC_H)
  57. #define POVMALLOC_H
  58.  
  59.  
  60. #include <dialogs.h>    // DialogPtr
  61.  
  62. // rename std. C library calls for all users (except POVMalloc.c itself!)
  63. #if !defined (POVMALLOC_C)
  64. #if MALLOC_TRACE
  65. #define malloc(p)                POV_malloc(p, __FILE__, __LINE__)
  66. #define calloc(size, nitems)    POV_calloc(size, nitems, __FILE__, __LINE__)
  67. #else
  68. #define malloc(p)                POV_malloc(p)
  69. #define calloc(size, nitems)    POV_calloc(size, nitems)
  70. #endif // MALLOC_TRACE
  71. #define realloc(p, newsize)        POV_realloc(p, newsize)
  72. #define free(p)                    POV_free(p)
  73. #endif // POVMALLOC_C
  74.  
  75. extern    OSErr POV_init_memtracking(size_t max_trackable);
  76. extern    void POV_enable_memtracking(Boolean dotracking);
  77. #if MALLOC_TRACE
  78. extern    void *POV_malloc(size_t size, char * src_file, short src_line_num);
  79. #else
  80. extern    void *POV_malloc(size_t size);
  81. #endif // MALLOC_TRACE
  82. #if MALLOC_TRACE
  83. extern    void *POV_calloc(size_t nmemb, size_t size, char * src_file, short src_line_num);
  84. #else
  85. extern    void *POV_calloc(size_t nmemb, size_t size);
  86. #endif // MALLOC_TRACE
  87. extern    void *POV_realloc(void * p, size_t newsize);
  88. extern    void POV_free(void *p);
  89. extern    Boolean POV_need_to_reclaim(void);
  90. extern    void POV_reclaim(Boolean BeVerbose, DialogPtr progressDialogPtr);
  91.  
  92.  
  93. #endif // POVMALLOC_H
  94.